package com.zpp.friend.controller.user;

import com.zpp.common.core.controller.BaseController;
import com.zpp.common.core.domain.Result;
import com.zpp.common.core.domain.TableDataInfo;
import com.zpp.friend.domain.exam.dto.ExamQueryDTO;
import com.zpp.friend.domain.user.dto.EnterExamDTO;
import com.zpp.friend.service.user.IUserExamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user/exam")
public class UserExamController extends BaseController {

    @Autowired
    private IUserExamService userExamService;

    //报名竞赛
    @PostMapping("/enter")
    public Result<Void> enter(@RequestBody EnterExamDTO enterExamDTO) {
        return toResult(userExamService.enter(enterExamDTO.getExamId()));
    }

    @GetMapping("/list")
    public TableDataInfo list(ExamQueryDTO examQueryDTO) {
        return userExamService.list(examQueryDTO);
    }
}
